package designpattern;

import designpattern.car.Toyota;
import designpattern.car.Volvo;
import designpattern.decorator.ToyotaDecorator;
import designpattern.decorator.VolvoDecorator;
import designpattern.factory.ToyotaFactory;
import designpattern.factory.VolvoFactory;

/**
 * @author Jonny Long
 * @date 2021/5/20 8:38
 */
public class Client {
    public static void main(String[] args) {
        /**
         * 丰田
         */
        // 工厂生产
        ToyotaFactory toyotaFactory = new ToyotaFactory();
        Toyota toyota = toyotaFactory.createCar();
        // 装饰
        ToyotaDecorator toyotaDecorator = new ToyotaDecorator(toyota);
        toyotaDecorator.printCar();
        toyotaDecorator.autopilot();
        toyotaDecorator.navigation();
        /**
         * 沃尔沃
         */
        VolvoFactory volvoFactory = new VolvoFactory();
        Volvo volvo = volvoFactory.createCar();

        VolvoDecorator volvoDecorator = new VolvoDecorator(volvo);
        volvoDecorator.printCar();
        volvoDecorator.navigation();
        volvoDecorator.voiceControl();
    }
}
